<?php

namespace app\models\db;

use Yii;

/**
 * This is the model class for table "t_express".
 *
 * @property string $id
 * @property string $express_no
 * @property string $create_datetime
 * @property string $order_id
 * @property string $money
 * @property string $express_comanpy
 *
 * @property TOrder $order
 */
class Express extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 't_express';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'express_no'], 'required'],
            [['create_datetime'], 'safe'],
            [['money'], 'number'],
            [['id', 'order_id'], 'string', 'max' => 36],
            [['express_no'], 'string', 'max' => 200],
            [['express_comanpy'], 'string', 'max' => 50],
            [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => Order::className(), 'targetAttribute' => ['order_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'express_no' => 'Express No',
            'create_datetime' => 'Create Datetime',
            'order_id' => 'Order ID',
            'money' => 'Money',
            'express_comanpy' => 'Express Comanpy',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getOrder()
    {
        return $this->hasOne(Order::className(), ['id' => 'order_id']);
    }
}
